﻿using System.Linq;
using AB.ServiceDirectory.Commons.DataFilters;
using AB.ServiceDirectory.Dao;
using AB.ServiceDirectory.Entities;

namespace AB.ServiceDirectory.BO
{
    /// <summary>
    /// HOrganizationBO
    /// </summary>
    public static class HOrganizationBO
    {
        /// <summary>
        /// HOrganisationDao Object
        /// </summary>
        private static readonly HOrganizationDao Dao = new HOrganizationDao();

        /// <summary>
        /// Gets the organisation.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="sortType">Type of the sort.</param>
        /// <param name="startRowIndex">The start rowindex.</param>
        /// <param name="maxRows">The max rows.</param>
        /// <returns></returns>
        public static IQueryable<Organization> GetOrganization(HOrganizationFilter filter, string sortType,
                                                               int startRowIndex, int maxRows)
        {
            return Dao.GetList(filter, sortType, startRowIndex, maxRows);
        }

        /// <summary>
        /// Gets the organisation by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public static Organization GetOrganizationById(int id)
        {
            return Dao.GetOrganizationById(id);
        }

        /// <summary>
        /// Gets the organisation count.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public static int GetOrganizationCount(HOrganizationFilter filter)
        {
            return Dao.GetListCount(filter);
        }
    }
}